package com.nexfra.bbssys.common.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.nexfra.bbssys.common.domain.AttachFile;

@Component
public class CommonDao {
	@Autowired
	private SqlSession sqlSession;

	public List<Map<String,Object>> selectTopMenuList(HashMap<String, String> sqlParams) {
		return sqlSession.selectList("CommonSqlMap.selectTopMenuList", sqlParams);
	}

	public List<Map<String,Object>> selectLeftMenuList(HashMap<String, String> sqlParams) {
		return sqlSession.selectList("CommonSqlMap.selectLeftMenuList", sqlParams);
	}	
////////////////////////
	
	/*public List<Map<String,Object>> getMenuList(HashMap<String, String> sqlParams) {
		return sqlSession.selectList("CommonSqlMap.getMenuList", sqlParams);
	}*/
	
	
	public List<Map<String,Object>> selectCommonCode(HashMap<String, String> sqlParams) {
		return sqlSession.selectList("CommonSqlMap.selectCommonCode", sqlParams);
	}
	
	public List<AttachFile> selectAttachFile(HashMap<String, String> sqlParams) {
		return sqlSession.selectList("CommonSqlMap.selectAttachFile", sqlParams);
	}

	public List<Map<String,Object>> getPsersonalConfig(HashMap<String, String> sqlParams) {
		return sqlSession.selectList("CommonSqlMap.getPsersonalConfig", sqlParams);
	}
	
	public void insertPersonalConfig(HashMap<String, String> sqlParams) 
			throws Exception {		
		sqlSession.insert("CommonSqlMap.insertPersonalConfig", sqlParams);
	}		
	
	public void deletePersonalConfig(HashMap<String, String> sqlParams) 
			throws Exception {		
		sqlSession.insert("CommonSqlMap.deletePersonalConfig", sqlParams);
	}		
	
	public void insertUser(Map user) {		
		//sqlSession.insert("test.insertItem", user);
	}	
}
